package com.dabai.iot.core.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dabai.common.tenant.core.TenantEntity;
import com.dabai.iot.common.enums.TopicSourceType;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

/**
 * 消息主题表 实体类
 *
 * @author kev1n
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("iot_product_topic")
public class ProductTopicEntity extends TenantEntity {

    /**
     * 主键id
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 产品id
     */
    @Schema(description = "产品id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long productId;

    /**
     * 主题
     */
    @Schema(description = "主题")
    private String topic;

    /**
     * 1:系统 2:自定义
     *
     * @see TopicSourceType
     */
    @Schema(description = "1:系统 2:自定义")
    private String topicSourceType;

    /**
     * 1:设备订阅 2:设备发布
     */
    @Schema(description = "1:设备订阅 2:设备发布")
    private String topicDirection;

    /**
     * 描述
     */
    @Schema(description = "描述")
    private String topicDesc;

    /**
     * 排序
     */
    @Schema(description = "排序")
    private Integer sort;

    /**
     * 删除标志（0代表存在 1代表删除）
     */
    @TableLogic
    private String delFlag;

}
